Repository navigation
MILAB-7348: greptile auto-approve in TypeScript with @actions/glob matching - #247
Merged
Merged
Conversation
…/glob matching Match protected paths with the @actions/glob globber against empty placeholder files, since the action has no checkout and a PR can delete or rename files. Matching is case-insensitive. An incorrect pattern protects all paths and fails the job.
|
Automatic reviews are disabled for this repository. Configure in Code Review Settings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrites
actions/greptile/auto-approvein TypeScript. The protected list now uses the@actions/globmatching rules, and matching is case-insensitive.Decisions
@actions/globfinds files on disk only, and has no public "does this path match" call. The action has no checkout, and a PR can delete or rename files, so a checkout would not show all changed paths. The action creates an empty placeholder file for each changed path (and the old path of a renamed file) in a temporary directory and runs the globber there. The internal matcher (@actions/glob/lib/internal-pattern) was rejected: it is not a public API, and 0.7 blocks deep imports.a/btoa/b/cgives a path that is a file and a directory at the same time. Such paths go into separate batches, one globber run for each./or~, or has a..segment, protects all paths, dismisses earlier bot approvals and fails the job. With the old bash matcher such a line silently matched nothing.node24because GitHub runners already run node20 actions on node24.Rule changes for consumers
The old matcher was bash
[[ $path == $pattern ]]. With the new rules:*does not match/:*.shmatches only root files, use**/*.sh.dir,dir/,dir/*) protects the full directory.!lines: the last matching line wins.#starts a comment only at the start of a line.milaboratory/plmust merge milaboratory/pl#2463 before this reachesv4: the current pl list has/platform/pkg/cfg, which the new action rejects. #2463 makes the pl list correct for the old and the new rules.Tests
pnpm exec vitest runinactions/greptile/auto-approve: 39 tests.lib/index.jsagainst milaboratory/pl#2464 (a test PR that changesplatform/model/field_state.go):main: not approved, incorrect pattern/platform/pkg/cfg, the job fails;PR touches protected path platform/model/field_state.go.